//
// Created by madison on 2022/1/6.
//

#include <stdio.h>

/* 全局变量声明 */
int g;
/* 全局变量声明 */
int a = 20;

int main() {
    /* 局部变量声明 */
    int a, b;
    int c;

    /* 实际初始化 */
    a = 10;
    b = 20;
    c = a + b;

    printf("value of a = %d, b = %d and c = %d\n", a, b, c);

    g = a + b;
    printf("value of a = %d, b = %d and g = %d\n", a, b, g);

    /* 局部变量声明 */
    int g = 10;
    printf("value of g = %d\n", g);


    int sum(int, int);

    printf("value of a in main() = %d\n", a);
    c = sum(a, b);
    printf("value of c in main() = %d\n", c);

    return 0;
}

/* 添加两个整数的函数 */
int sum(int a, int b) {
    printf("value of a in sum() = %d\n", a);
    printf("value of b in sum() = %d\n", b);

    return a + b;
}